<tbody id="dynamic-forms" phx-update="append" phx-hook="CommitDiffDynamicForms">
  <%= for {oid, hunk_index, line_index} <- @forms do %>
    <tr id={"review-#{oid_fmt(oid)}-#{hunk_index}-#{line_index}-form"} class="inline-comments">
      <td colspan="4">
        <div class="timeline">
          <div class="timeline-item">
            <div class="timeline-content">
              <div class="comment-form">
                <%= live_component(GitGud.Web.CommentFormLive,
                  id: "review-#{oid_fmt(oid)}-#{hunk_index}-#{line_index}-comment-form",
                  current_user: @current_user,
                  repo: @repo,
                  repo_permissions: @repo_permissions,
                  agent: @agent,
                  minimized: false,
                  phx_change: "validate_comment",
                  phx_submit: "add_comment") do %>
                    <% comment_form_assigns -> %>
                      <input type="hidden" name="oid" value={oid_fmt(oid)} />
                      <input type="hidden" name="hunk" value={hunk_index} />
                      <input type="hidden" name="line" value={line_index} />
                      <div class="control">
                        <button class="button" type="reset" phx-click="reset_review_form" phx-value-oid={oid_fmt(oid)}, phx-value-hunk={hunk_index} phx-value-line={line_index}>Cancel</button>
                      </div>
                      <div class="control">
                        <%= submit "Add comment", class: "button is-success", disabled: Keyword.fetch!(comment_form_assigns, :changeset).changes == %{} %>
                      </div>
                <% end %>
              </div>
            </div>
          </div>
        </div>
      </td>
    </tr>
  <% end %>
</tbody>
